<style>
   .row, .row-time {
      background-color: #ffffff;
   }
   .top {
      display: flex;
      flex-direction: row;
      margin: 20px 20px 20px 30px;
   }
   .top-left {
      display: flex;
      flex-direction: row;
      width:70%;
   }
   .top-img img {
      display: block;
      border-radius: 50%;
   }
   .top-left-title {
      display: flex;
      flex-direction: column;
      justify-content: center;
   }
   .top-left-title span {
      margin: 10px 20px;
   }
   .top-right {
      display: flex;
      flex-direction: row;
      justify-content: space-around;
   }
   .top-right-title {
      display: flex;
      flex-direction: column;
      margin: 10px 15px;
   }
   .top-right-title span {
      margin: 10px;
      font-size: 30px;
      color: #434b54;
      text-align: center;
   }
   .top-line {
      border:1px solid #434b54;
      height: 70px;
      margin: 20px;
   }
   .title {
      margin:20px;
   }

</style>
<div>
   <div class="row">
      <div class="top">
         <div class="top-left">
            <p class="top-img"><img src="/common/img/profile-photos/1.png"></p>
            <p class="top-left-title">
               <span>
                    #(user?user.username:'')
               </span>
               <span>
                    #(user?user.name:'')#(user?user.email:'')
               </span>
            </p>
         </div>
         <div class="top-right">
            <p class="top-right-title">
               <span>指标数</span>
               <span>#(totalNum)</span>
            </p>
            <p class="top-line"></p>
            <p class="top-right-title">
               <span>问卷数</span>
               <span>#(paperTotal)</span>
            </p>
         </div>
      </div>
   </div>
   <!--<div class="title">-->
      <!--<i class="ti-save"></i>-->
      <!--<span style="font-size: 20px;padding: 20px 0px 0px 0px">问卷统计分析</span>-->
   <!--</div>-->
   <!--<div type="hidden" id="list">#(list)</div>-->
   <!--<div class="row-time">-->
      <!--<div class="top">-->
         <!--<div class="top-left" style="width: 20%;">-->
            <!--<p class="top-img"><img src="/common/img/profile-photos/1.png" style="width: 50px;margin: 20px"></p>-->
            <!--<p class="top-left-title">-->
               <!--<span>-->
                    <!--#(user?user.username:'')-->
               <!--</span>-->
               <!--<span>-->
                    <!--2019.5.8-->
               <!--</span>-->
            <!--</p>-->
         <!--</div>-->
         <!--<div class="top-right">-->
            <!--<p style="margin: 10px;color: #3d99e4;font-size: 20px;">填写问卷</p>-->
         <!--</div>-->
      <!--</div>-->
   <!--</div>-->
   <div>
    #for(x:totalValue)
      <span>#(x.paperTitle)：#(x.total_value ?? "0")</span>
      #end
   </div>
   <div class="row">
      <div id="main1" style="width: 100%;height: 400px;"></div>
      <div style="height:200px;"></div>
      <div id="main2" style="width: 100%;height: 400px;"></div>
   </div>
</div>
<script src="#(ctx)/assets/js/echart/echarts.min.js"></script>
<script type="text/javascript">
    $(function() {
//        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('main1'));
        var myChart2 = echarts.init(document.getElementById('main2'));
        myChart.setOption({
            title : {
                text : '一级指标平均得分情况',
                textStyle : {
                    color : '#555',

                },
                x:'center',
                y:'top',
                textAlign:'center'
            },
            tooltip: {},
            legend: {
                left:'20%'
            },
            toolbox : {
                show : true,
                feature : {
                    magicType : {
                        show : true,
                        type : [ 'line', 'bar' ]
                    },
                    restore : {
                        show : true
                    },
                    saveAsImage : {
                        show : true,
                        title : '保存为图片',
                        type : 'png',
                        lang : [ '点击保存' ]
                    }
                },
                right:'10%'
            },
            grid: {
                left: '3%',
                right: '10%',
                bottom: '3%',
                containLabel: true
            },
            xAxis: {
                data: []
            },
            yAxis: [ {
                type : 'value',
                name: '综合得分',
                splitArea : {
                    show : true
                }
            } ],
            series: [{
                name: '综合得分',
                type: 'bar',
                data: [],
                barWidth : 30
            }]
        });
        myChart.showLoading();
        myChart2.setOption({
           /* title : {
                text : '二级指标平均得分情况',
                x:'center',
                y:'top',
                textStyle : {
                    color : '#555'
                }
            },
            tooltip: {
                trigger: 'axis'
            },
            series: [{
                name: '平均得分',
                type: 'radar',
                data: []
            }]*/
            title : {
                text : '二级指标平均得分情况',
                textStyle : {
                    color : '#555',

                },
                x:'center',
                y:'top',
                textAlign:'center'
            },
            tooltip: {},
            legend: {
                left:'20%'
            },
            toolbox : {
                show : true,
                feature : {
                    magicType : {
                        show : true,
                        type : [ 'line', 'bar' ]
                    },
                    restore : {
                        show : true
                    },
                    saveAsImage : {
                        show : true,
                        title : '保存为图片',
                        type : 'png',
                        lang : [ '点击保存' ]
                    }
                },
                right:'10%'
            },
            grid: {
                left: '3%',
                right: '10%',
                bottom: '3%',
                containLabel: true
            },
            xAxis: {
                data: []
            },
            yAxis: [ {
                type : 'value',
                name: '综合得分',
                splitArea : {
                    show : true
                }
            } ],
            series: [{
                name: '综合得分',
                type: 'bar',
                data: [],
                barWidth : 30
            }]
        });
        myChart2.showLoading();
        var name=[],nums=[],name2=[],nums2=[],item=[];
        var data = common_ajax.ajaxFunc("/admin/home/getTotalValue",{},"json", null);
        console.log(data);
        if(data.data.first.length>0){
             for(var i=0;i<data.data.first.length;i++) {
                name.push(data.data.first[i].name)
                nums.push(data.data.first[i].value)
             }
             myChart.hideLoading()
             myChart.setOption({
                xAxis: {
                   name: '一级指标',
                   data: name,
                   type : 'category',
                   axisLabel:{
                      interval:0,//横轴信息全部显示
                      rotate:30,//让坐标值旋转一定的角度
                   },
                },
                series: [{
                   data: nums,
                   itemStyle: {
                       normal: {
                           label: {
                               show: true, //开启显示
                               position: 'top', //在上方显示
                               textStyle: { //数值样式
                                   color: 'black',
                                   fontSize: 16
                               }
                           }
                       }
                   }
                }],
             })
        } else {
             myChart.hideLoading()
        }
        if(data.data.second.length>0){
            for(var i=0;i<data.data.second.length;i++) {
                name2.push(data.data.second[i].name);
                nums2.push(data.data.second[i].value);
            }
            myChart2.hideLoading()
            myChart2.setOption({
                /*series: {
                    type: 'radar',
                    tooltip: {
                        trigger: 'item'
                    },
                    itemStyle: {normal: {areaStyle: {type: 'default'}}},
                    data: [
                        {
                            value: nums2,
                            name: '平均得分'
                        }
                    ]
                },
                radar: [
                    {
                        shape: 'circle',
                        indicator: item,
                        center: ['50%','50%'],
                        radius: 80
                    }
                ],*/
                xAxis: {
                    name: '二级指标',
                    data: name2,
                    type : 'category',
                    axisLabel:{
                        interval:0,//横轴信息全部显示
                        rotate:30,//让坐标值旋转一定的角度
                    },
                },
                series: [{
                    data: nums2,
                    itemStyle: {
                        normal: {
                            label: {
                                show: true, //开启显示
                                position: 'top', //在上方显示
                                textStyle: { //数值样式
                                    color: 'black',
                                    fontSize: 16
                                }
                            }
                        }
                    }
                }]
            })
        }else {
            myChart2.hideLoading()
        }

    })
</script>